#include <iostream>
#include <signal.h>
#include <unistd.h>

using namespace std;

// 自定义信号处理函数
void sigint_handler(int signum) 
{
    cout << "this is NO." << signum << " signal" << endl;
}

int main() {
    // 注册信号处理函数
    if (signal(SIGINT, sigint_handler) == SIG_ERR) {
        perror("signal");
        return 1;
    }

    while (1) 
    {   
        cout << "this is a process" << endl;
        sleep(1);
    }

    return 0;
}